package cn.yunyichina.scheduler.jobs.job.register;

import cn.yunyichina.scheduler.jobs.service.register.RegisterSchedulerService;
import cn.yunyichina.scheduler.jobs.service.register.RegisterStopService;
import com.dangdang.ddframe.job.api.ShardingContext;
import com.dangdang.ddframe.job.api.type.simple.api.SimpleJob;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.concurrent.atomic.AtomicInteger;

/**
 * 挂号定单重试定时任务
 * Created by Administrator on 2017/5/3.
 */
@Component
public class RegisterSchedulerJob implements SimpleJob {
    private static final Logger logger = LoggerFactory.getLogger(RegisterSchedulerJob.class);
    private static final AtomicInteger count = new AtomicInteger(0);
    @Resource
    private RegisterSchedulerService registerSchedulerService;

    @Override
    public void execute(ShardingContext shardingContext) {
        int current = count.addAndGet(1);
        logger.info("第[{}]次挂号定单重试定时任务开始执行", current);
        registerSchedulerService.doExecute();
        logger.info("第[{}]次挂号定单重试定时任务执行结束", current);
    }
}
